package com.shujia.base;

import org.apache.log4j.Logger;

import java.io.BufferedReader;
import java.io.FileReader;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

public class LoggerToHive {
    public static void main(String[] args) throws Exception {

        //创建一个logger对象
        Logger logger = Logger.getLogger(LoggerToFlume.class.getName());


        BufferedReader br = new BufferedReader(new FileReader("flume/data/jdgoods.csv"));

        String line = null;
        while ((line=br.readLine())!=null){
            StringBuilder sb = new StringBuilder();
            String[] strings = line.split(",");
            if(strings.length==6){
                sb.append(strings[1]).append(",").append(strings[2])
                        .append(",").append(strings[3])
                        .append(",").append(strings[4])
                        .append(",").append(strings[5]);
                logger.info(sb.toString());
                Thread.sleep(500);
            }
        }

    }
}
